import { createStore } from 'vuex'
import { HomeListApi } from '@/api/home';

export default createStore({
  state: {
    vuexnum: 10,
    homeListDatas: null
  },
  mutations: {
    changeVuexNum(state, data) {
      console.log(state, data);
      state.vuexnum = data;
    },
    // 改变list数据mutaion方法
    changeHomeListDatas(state, data) {
      console.log(data);
      state.homeListDatas = data;
    }
  },
  actions: {
    async actChangeHomeListDatas(context, actData) {
      let rel = await HomeListApi(actData);
      console.log(rel);
      context.commit('changeHomeListDatas', rel.data.data);
    }
  },
  getters: {
  },
  modules: {
  }
})
